{% load state_display %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body, html {
            padding: 0px;
            margin: 0px;
            width: 100%;
            height: 100%;
        }
        .input-style {
            display: inline-block;
            width: 98%;
            height: 35px;
            font-size: 14px;
            border: none;
            background: white;
        }
        table {
            border-collapse: collapse;
            border-spacing: 0;
        }
        tr {
            height: 35px;
        }

        th {
            text-align: center;
        }
        td {
            outline: none;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;
            color: #01AAED;
        }
        p {
            outline: none;
        }
        .tab_top {
            width: 100px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            display: inline-block;
            cursor: pointer;
        }

        .file {
            position: relative;
            display: inline-block;
            background: #D0EEFF;
            border: 1px solid #99D3F5;
            border-radius: 4px;
            padding: 4px 12px;
            overflow: hidden;
            color: #1E88C7;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }

        .file input {
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }
        .a_tag_cla{
            display: block;
            /*超出隐藏*/
            overflow: hidden;
            /*禁止换行*/
            white-space: nowrap;
            /*超出用省略号代替*/
            text-overflow: ellipsis;height: 30px;line-height: 30px;padding-left: 1%;
        }
        .file:hover {
            background: #AADFFD;
            border-color: #78C3F3;
            color: #004974;
            text-decoration: none;
        }
        .shade {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(36, 36, 36, 0.5);
            display: none;
            z-index: 10000;
        }
        #addForm2 {
            width: 500px;
            height: 550px;
            background: #F5F5F5;
            position: absolute;
            border: #dfdfdf solid 1px;
            margin: auto;
            border-radius: 3px;
            top: 50%;
            left: 50%;
            /* 实现鼠标拖拽使用css3效果 */
            transform: translate(-50%, -50%);
            z-index: 10100;
            font-size: 0;
        }
        #title2 {
            display: flex;
            justify-content: space-between;
            box-sizing: border-box;
            padding: 0 10px;
            height: 40px;
            color: #0b0b0b;
            cursor: move;
            /*border: #dfdfdf solid 1px;*/
            width: 498px;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        #loading { background: #fff url(../../static/public_file/images/jiazai.gif) no-repeat scroll center center; height: 100%; width: 100%; background-size: 10%; position: fixed; margin-top: 0px; top: 0px; left: 0px; bottom: 0px; overflow: hidden !important; right: 0px; z-index: 999999;background-color: rgba(255, 255, 255, 0.08);}

    </style>
</head>
<body>
    <div id="loading">
        <div id="loading-center">
        </div>
    </div>

    <div style="width: 100%;height: 40px;background: white;border-bottom: #cfcfcf solid 0.5px;line-height: 40px;color: black;">
        <div id="DW_tag" class="tab_top top_tag" onclick="change_mind('DW')">
            申请详情
        </div>
        <div id="lct_tag" class="tab_top" onclick="change_mind('lct')">
            流程图
        </div>
        <button onclick="ExportCar()" style="float: right;width: 100px;height: 30px;line-height: 30px;margin-top: 5px;border-radius: 3px;border: #1E90FF solid 0.5px;background-color: #1E90FF;color: white;cursor: pointer;margin-right: 15px;">提交</button>

        <div style="width: 110px;float: right;text-align: center;height: 40px;">
            <button style="line-height: 27px;border-radius: 3px;border: #1E90FF solid 0.5px;width: 100px;height: 30px;margin-top: 5px;background: #1E90FF;color: white;"><a href="javascript:history.go(-1)" style="color: white;">返回</a></button>
        </div>
    </div>

    <div id="DW" style="width: 100%;height: 95%;background: white;overflow: auto;">
        <div id="menu_from" style="width: 100%;height: auto;color: #2C3E50;display: inline-block;vertical-align: top;background: white;">
            <div style="width: 100%;height: 90%;display: inline-block;vertical-align: center;">
                <div style="width: 95%;margin-left: 2.5%;">
                    <table style="width: 100%;margin-top: 20px;">
                        <tr>
                            <td colspan="4" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;">
                                <h3 id="form_name" style="letter-spacing: 8px;">图书/报刊/杂志征订</h3>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;background: #DFDFDF;border: #cfcfcf solid 1px;border-top: none;">基本信息</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 15%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                                申&nbsp;&nbsp;请&nbsp;&nbsp;人
                            </td>
                            <td id="applicat" style="width: 35%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;">{{ obj.apply_user.real_name }}</td>

                            <td style="width: 15%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                                申请部门
                            </td>
                            <td id="department" style="width: 35%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">{{ obj.company.name }}</td>
                        </tr>
                        <tr>
                            <td colspan="4" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;background: #dfdfdf;border: #cfcfcf solid 1px;">申请详情</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td colspan="4" style="width: 100%;border: #cfcfcf solid 0.5px;text-align: center;height: 40px;line-height: 40px;">
                                书籍购买
                                {% if is_edit == 'true' %}
                                    <span style="float: right;padding-right: 10px;color: #00a0e9;cursor: pointer;" onclick="add_total_project()">添加</span>
                                {% endif %}
                            </td>
                        </tr>
                    </table>
                    <table id="BookBuy" style="width: 100%;">
                        <tr style="width: 100%;">
                            <td style="width: 4%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">序号</td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">书籍名称</td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">作者</td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">出版社</td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">第几版</td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">备注</td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">科室</td>
                        </tr>
                        {% if book_buy|length %}
                            {% for foo in book_buy %}
                                <tr style="width: 100%;">
                                    <td class="a" style="width: 4%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">{{ foo.a }}</td>
                                    <td class="b" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}">{{ foo.b }}</td>
                                    <td class="c" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}">{{ foo.c }}</td>
                                    <td class="d" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}">{{ foo.d }}</td>
                                    <td class="e" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}">{{ foo.e }}</td>
                                    <td class="f" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}">{{ foo.f }}</td>
                                    <td style="width: 16%;height: 40px;border: #cfcfcf solid 1px;border-top: none;">
                                        <p class="g" style="width: 70%;display: inline-block;text-align: center;" contenteditable="{{ is_edit }}">{{ foo.g }}</p>
                                        {% if is_edit == 'true' %}
                                            <span onclick="remove_time_adress(this, '1')" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                                        {% endif %}
                                    </td>
                                </tr>
                            {% endfor %}
                        {% else %}
                            <tr style="width: 100%;">
                                <td class="a" style="width: 4%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">1</td>
                                <td class="b" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="c" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="d" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="e" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="f" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;border-top: none;">
                                    <p class="g" style="width: 70%;height: 100%;display: inline-block;vertical-align: top;" contenteditable="{{ is_edit }}"></p>
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                    <table style="width: 100%;">
                        <tr style="margin-left: 1%;">
                            <td colspan="4" style="width: 100%;border: #cfcfcf solid 0.5px;text-align: center;height: 40px;line-height: 40px;border-top: none;">
                                报刊杂志征订
                                {% if is_edit == 'true' %}
                                    <span style="float: right;padding-right: 10px;color: #00a0e9;cursor: pointer;" onclick="add_total_project1()">添加</span>
                                {% endif %}
                            </td>
                        </tr>
                    </table>
                    <table id="PressBuy" style="width: 100%;">
                        <tr style="width: 100%;">
                            <td style="width: 4%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">序号</td>
                            <td style="width: 32%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">报刊杂志名称</td>
                            <td style="width: 32%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">邮发代号</td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">备注</td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">科室</td>
                        </tr>
                        {% if reason|length %}
                            {% for foo in reason %}
                                <tr style="width: 100%;">
                                    <td class="h" style="width: 4%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">{{ foo.h }}</td>
                                    <td class="i" style="width: 32%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}">{{ foo.i }}</td>
                                    <td class="j" style="width: 32%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}">{{ foo.j }}</td>
                                    <td class="k" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}">{{ foo.k }}</td>
                                    <td style="width: 16%;height: 40px;border: #cfcfcf solid 1px;border-top: none;" contenteditable="{{ is_edit }}">
                                        <p style="width: 70%;display: inline-block;text-align: center;" class="l" contenteditable="{{ is_edit }}">{{ foo.l }}</p>
                                        {% if is_edit == 'true' %}
                                            <span onclick="remove_time_adress(this, '1')" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                                        {% endif %}
                                    </td>
                                </tr>
                            {% endfor %}
                        {% else %}
                            <tr style="width: 100%;">
                                <td class="h" style="width: 4%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">1</td>
                                <td class="i" style="width: 32%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="j" style="width: 32%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="k" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;border-top: none;" contenteditable="{{ is_edit }}">
                                    <p class="l" style="width: 70%;display: inline-block;vertical-align: top;" contenteditable="{{ is_edit }}"></p>
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                    <table style="width: 100%;">
                        <tr>
                            <td colspan="2" style="height: 40px;padding-left: 0.5%;line-height: 40px;background: #dfdfdf;border: #cfcfcf solid 0.5px;border-top: none;">
                                审批详情
                            </td>
                        </tr>
                        {% if 'one' in audit_dic %}
                            <tr id="fzrcs_tr" style="width: 100%;{% if obj.is_leader == True %} display: none{% endif %}">
                                <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    科主任审核
                                </td>
                                <td id="fzrcs"
                                    style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'one' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div id="fzrcs_op"
                                                         style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'two' in audit_dic %}
                            <tr id="fgld_tr" style="width: 100%;">
                                <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    图书室查询
                                </td>
                                <td id="fgld"
                                    style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'two' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'three' in audit_dic %}
                            <tr id="three_tr" style="width: 100%;">
                                <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    病案统计科
                                </td>
                                <td id="three"
                                    style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'three' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'four' in audit_dic %}
                            <tr id="four_tr" style="width: 100%;">
                                <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    病案统计科分管领导
                                </td>
                                <td id="four"
                                    style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'four' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div id="lct" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="width: 100%;height: 40%;text-align: center;margin: 20% auto;">
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    ({{ obj.apply_user.real_name }})<br>
                    发起人
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    start
                </div>
            </div>

            {% if 'one' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'one' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                科主任审核
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'two' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'two' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                图书室查询
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'three' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'three' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                病案统计科
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'four' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'four' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                病案统计科分管领导
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            <div style="display: inline-block;border: #0d8ddb solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    <span style="visibility: hidden;">({{ obj.apply_user.real_name }})</span><br>
                    结束
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    ending
                </div>
            </div>
        </div>
    </div>

    <div id="del_adjunct"
         style="z-index: 1000;position: fixed;background-color: rgba(36, 36, 36, 0.5);width: 100%;height: 100%;top: 0;left: 0;right: 0;bottom: 0;display: none;">
        <div style="top: 50%;left: 50%;width: 400px;height: 150px;background: white;transform:translate(-50%,-50%);border: #dfdfdf solid 1px;position: absolute;border-radius: 4px;">
            <div style="width: 100%;height: 100px;text-align: center;line-height: 100px;">请查看附件，删除无用的附件！</div>
            <hr>
            <div style="width: 100%;height: 50px;text-align: right;padding-right: 5%;">
                <button onclick="del_adjunct_button()"
                        style="width: 50px;height: 30px;line-height: 30px;margin-top: 10px;background: #00a0e9;color: white;border-radius: 4px;border: #00a0e9 solid 1px;">
                    确认
                </button>
            </div>
        </div>
    </div>

    <script src="../../static/system_setup/creat_from/js/jquery-1.10.2.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
        }
        var uuid = "{{ obj.fj_number }}"
        function change_mind(ele_id) {
            if (ele_id === "DW") {
                document.getElementById("DW").style.display = "inline-block";
                document.getElementById("DW_tag").className = "tab_top top_tag";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
            } else {
                document.getElementById("lct").style.display = "inline-block";
                document.getElementById("lct_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
            }
        }

        // 修改
        function ExportCar() {
            var seal_check = document.getElementsByName("choose_seal");
            var leimuneirong =  document.getElementsByClassName("leimuneirong");
            var leimuxuhao_list = document.getElementsByClassName("leimuxuhao")
            var detail_json = []
            for (var i=0; i<seal_check.length; i++) {
                detail_json.push({"xuhao": leimuxuhao_list[i].innerText, "yinzhang": parseInt(seal_check[i].value), 'neirong': leimuneirong[i].innerText})
            }

            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/finance/QuickAuthorizationIndex.html", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("detail_json=" + JSON.stringify(detail_json)+"&id="+'{{ obj.id }}'+"&admin=true");
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("修改成功");
                            window.location = "QuickAuthorizationList.html";
                        } else {
                            alert(JsonDate['message']);
                            document.getElementById("loading").style.display = "none";
                        }
                    }
                }
            };
        }

        function chage_yulan(this_, file_path) {
            var fujian = document.getElementById("fujian");
            var file_index = file_path.lastIndexOf(".")
            var ext = file_path.substring(file_index+1)
            var arr=['jpg', 'JPG', "JPEG", "jpeg", "PNG", "png"];
            var ext_index=arr.indexOf(ext);
            if (ext_index === -1){
                fujian.innerHTML = '<embed id="embed_file" src="'+file_path+'" type="" style="width: 100%;height: 100%;">'
            }else {
                fujian.innerHTML = '<img src="' + file_path + '" alt="application/pdf" style="width: 800px;height: 100%;">'
            }

            var a_tag_list = document.getElementsByClassName("a_tag_cla");
            for (var i = 0;i<a_tag_list.length; i++){
                a_tag_list[i].style.background='';
            }
            this_.style.background='#cfcfcf';
        }

        // 删除附件
        function RemoveTr(_this, tbody_id, wj_id) {
            var table = document.getElementById(tbody_id);
            var trNode = $(_this).parent().parent();
            trNode.remove();

            for (var i=0; i<table.children.length; i++){
                table.children[i].children[0].innerHTML=i+1;
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+String(wj_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }

        // 上传附件
        function upload_accessory(file_type, tbody_id, accessory_type) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            form.append(file_type, files);
            form.append('number', "{{ obj.fj_number }}")
            form.append('source', 'yysq');

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        creat_table(JsonDate, tbody_id)
                    }
                }
            };
        }

        // 创建附件列表
        function creat_table(JsonData, tbody_id) {
            var t_table = document.getElementById(tbody_id);
            var local_host = window.location.host;
            if (Array.isArray(JsonData["pdf_path"])) {
                for (var i = 0; i < JsonData["pdf_path"].length; i++) {
                    var tr = document.createElement("tr");var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                    td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                    td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                    td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                    td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                    td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                    td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"][i]["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["pdf_path"][i]["id"] + "\")'>删除</a>";
                    td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";
                    tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td5);tr.appendChild(td6);
                    t_table.appendChild(tr);
                }
                if (JsonData["pdf_path"].length > 1) {
                    document.getElementById("del_adjunct").style.display = 'block';
                }
            } else {
                tr = document.createElement("tr");td1 = document.createElement("td");td2 = document.createElement("td");td3 = document.createElement("td");td4 = document.createElement("td");td5 = document.createElement("td");td6 = document.createElement("td");
                td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["id"] + "\")'>删除</a>";
                td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                t_table.appendChild(tr);
            }
        }

        function add_total_project() {
            var counts = document.getElementsByClassName('a').length+1;
            var html = `
                        <tr style="width: 100%;">
                            <td class="a" style="width: 4%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">`+String(counts)+`</td>
                            <td class="b" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="c" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="d" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="e" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="f" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true">
                                <p class="g" style="width: 70%;display: inline-block;text-align: center;" contenteditable="true"></p>
                                <span onclick="remove_time_adress(this, '1')" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                            </td>
                        </tr>
            `
            $("#BookBuy").append(html);
        }

        function add_total_project1() {
            var counts = document.getElementsByClassName('h').length+1;
            var html = `
                        <tr style="width: 100%;">
                            <td class="h" style="width: 4%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">`+String(counts)+`</td>
                            <td class="i" style="width: 32%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="j" style="width: 32%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="k" style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td style="width: 16%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;border-top: none;" contenteditable="true">
                                <p class="l" style="width: 70%;display: inline-block;text-align: center;" contenteditable="true"></p>
                                <span onclick="remove_time_adress(this, '1')" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                            </td>
                        </tr>
            `
            $("#PressBuy").append(html);
        }

        function remove_time_adress(obj, word) {
            var trNode = $(obj).parent().parent();
            trNode.remove();
        }
    </script>
</body>
</html>